package booking.tests;

import org.junit.*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.WebDriverWait;

import booking.pages.*;
import booking.utils.Verificator;
import static booking.utils.TestData.*;

public class SearchNotFoundVerification {
	
	private static WebDriver driver;
	private static WebDriverWait wait;
	private static Verificator verify;
	
	@Before
	public void beforeTest() {
		driver = new FirefoxDriver();
		wait = new WebDriverWait(driver, 15);
		verify = new Verificator();
		driver.get(loginUrl);
	}
	
	@Test
	
	public void verifylogin() throws InterruptedException {
		HomePage home = new HomePage(driver, wait);
		
		home.navigateToLoginPage()
			.loginAs(loginData, passwordData)
			.gotToHomePage()
			.isAtHomePage()
			.searchForTickets(fromData, toData, dateData, timeFromData)
			.isResNotFoundDisplayed();
		
		verify.checkIfElementDisplayedValueIs(home.getResNotFoundText(), ResNotFoundText);
	}
	
	@After
	public void afterTest() {
		driver.quit();
	}

}
